10fa99004b5d9a177cfe3aba8082c48bd6aa4227,java/code/src/com/redhat/rhn/frontend/events/SsmPackagesAction.java,SsmPackagesAction,scheduleAction,#SsmPackageEvent#User#,102

Before Change


        // If we have a remote-cmd, have to correctly order it and the package action(s)
        if (event.getScriptDetails() != null) {
            ScriptActionDetails sad = event.getScriptDetails();
            if (event.isBefore()) {
                log.debug("Scheduling remote-action BEFORE.");

                ScriptRunAction sra = ActionManager.scheduleScriptRun(user, serverIds,
                        null, sad, earliest);
                ActionManager.storeAction(sra);

                List<Action> pkgActions = doSchedule(event, user, serverIds, earliest);

                // Might be more than one action from schedPkgActions
                Action prevAction = sra;
                for (Action a : pkgActions) {
                    a.setPrerequisite(prevAction);
                    ActionManager.storeAction(a);
                    prevAction = a;
                }

            }
            else {
                log.debug("Scheduling remote-action AFTER.");

                List<Action> pkgActions = doSchedule(event, user, serverIds, earliest);
                ScriptRunAction sra = ActionManager.scheduleScriptRun(user, serverIds,
                        null, sad, earliest);

                // Might be more than one action from schedPkgActions
                Action prevAction = null;
                for (Action a : pkgActions) {
                    if (prevAction != null) {
                        a.setPrerequisite(prevAction);
                    }
                    ActionManager.storeAction(a);
                    prevAction = a;
                }

After Change



        // If we have a remote-cmd, have to correctly order it and the package action(s)
        if (event.getScriptDetails() != null) {
            for (Long sid : serverIds) {
                Server s = ServerFactory.lookupById(sid);
                List<Long> sidList = new ArrayList<Long>();
                sidList.add(sid);
                ScriptActionDetails sad = event.getScriptDetails();
                if (event.isBefore()) {
                    log.debug("Scheduling remote-action BEFORE.");

                    ScriptRunAction sra = ActionManager.scheduleScriptRun(user, sidList,
                                    null, sad, earliest);
                    ActionManager.storeAction(sra);

                    Action pkgAction = doSchedule(event, user, s, earliest);

                    Action prevAction = sra;
                        pkgAction.setPrerequisite(prevAction);
                        ActionManager.storeAction(pkgAction);
                        prevAction = pkgAction;

                }